package com.sky.controller.user;


import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * PROJECT_NAME: sky-take-out
 * NAME: ShopController
 * USER: zhang
 * DATE: 2023/5/20
 * DESCRIPTION :B端:店铺信息表现层
 */
@Slf4j
@RestController("userShopController")
@Api(tags = "C端-店铺信息表现层")
@RequestMapping("/user/shop")
public class ShopController {


    /**
     * 由于修改店铺状态/获取店铺状态都要该KEY,抽取出来!
     */
    private static final String SHOP_STATUS = "SHOP_STATUS";
    @Resource
    private RedisTemplate redisTemplate;



    /**
     * 获取店铺状态
     *
     * @return 将获取到的状态返回
     */
    @ApiOperation("C端-获取店铺状态")
    @GetMapping("/status")
    public Result<Integer> selectShopStatus(){
        Integer shopStatus = (Integer) redisTemplate.opsForValue().get(SHOP_STATUS);
        return Result.success(shopStatus);
    }
}
